from PIL import Image, ImageDraw, ImageFont
import numpy as np 
import cv2 

def getTextImage(img, text):
	img2 = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
	pil_img = Image.fromarray(img2)
	draw = ImageDraw.Draw(pil_img)
	font = ImageFont.truetype("msyh.ttf", 40, encoding='utf-8')
	draw.text((0,0), text, (0,0,255), font=font)
	res = cv2.cvtColor(np.array(pil_img), cv2.COLOR_RGB2BGR)
	return res

def getOverImage(img, src):
	srcImg = cv2.imread(src, cv2.IMREAD_UNCHANGED)
	srcImg = cv2.resize(srcImg, (40,40), interpolation=cv2.INTER_CUBIC)
	roi = img[0:40,0:40]
	np.copyto(roi,srcImg)
	return img